\documentclass[t,12pt,aspectratio=169]{beamer} % 16:9 宽屏比例，适合现代投影
\usepackage{ctex} % 中文支持
\usepackage{amsmath, amssymb} % 数学公式与符号
\usepackage{graphicx}
\usepackage{hyperref}
%\usepackage{booktabs} % 用于高质量表格
\usepackage{tikz} % 可选：用于绘图
\usetikzlibrary{shapes,arrows,graphs}
\usepackage{pythonhighlight}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 使表格美观
\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
%\newcolumntype{N}{@{}m{0pt}@{}}
\setlength\extrarowheight{3pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 主题设置（推荐简洁风格）
\usetheme{Madrid}
\usecolortheme{default} % 可选：seahorse, beaver, dolphin 等

\title{斐波那契数列 }
\author{五六七}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

% 封面页
\begin{frame}
  \titlepage
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{内容提要 }

\begin{enumerate}

\item  根据数列的递推关系式计算数列的通项。
\item  矩阵对角化方法。
\item  递推关系降阶方法。

\end{enumerate}


\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{目录}

\begin{enumerate}
\item  问题描述
\item  建立模型
\item  求解模型
\item  编程计算
\item  回答问题
\item  习题

\end{enumerate}

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{1.1. 问题描述 }

\begin{itemize}\itemsep0.5em 

\item  设有一对兔子出生一个月后开始繁殖，每个月出生一对小兔子。小兔子一个月后也开始繁殖，每个月又出生一对小兔子。假设兔子只有繁殖，没有死亡，求第 $k$ 个月的时候一共有多少对兔子？


\end{itemize} 

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{2.1. 建立模型 }

\begin{itemize}\itemsep0.5em 

\item  设第 $k$ 个月开始的时候，一共有 $F_k$ 对兔子。则根据题目假设，有
\begin{table}[ht]\centering
\caption{前几个月的兔子数量（单位：对）}\vspace{0.1cm}
\begin{tabular}{|M{2cm}|M{1cm}|M{1cm}|M{1cm}|M{1cm}|M{1cm}|M{1cm}|M{1cm}|}\hline 
月份 &0&1&2&3&4&5 & $\cdots$\\ \hline 
兔子数量 &1&1&2&3&5&8& $\cdots$ \\ \hline 
\end{tabular}
\end{table}

\item  写成递推关系式，可得
\begin{eqnarray}
F_0=1, F_1=1, F_{k+2}=F_{k+1}+F_k, k=0,1,2,\cdots.  
\end{eqnarray}

\end{itemize} 

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{3.1. 求解模型（矩阵的对角化方法） }

\begin{itemize}\itemsep0.5em 

\item  数列的递推关系式可以写成如下形式
\begin{eqnarray}
\begin{bmatrix} F_{k+1} \\ F_{k+2} \end{bmatrix} 
=
\begin{bmatrix} 0&1 \\ 1&1 \end{bmatrix} 
\begin{bmatrix} F_k \\ F_{k+1} \end{bmatrix}.  
\end{eqnarray}
由此可得
\begin{eqnarray}
\begin{bmatrix} F_{k+1} \\ F_{k+2} \end{bmatrix} 
=
\begin{bmatrix} 0&1 \\ 1&1 \end{bmatrix} 
\begin{bmatrix} F_k \\ F_{k+1} \end{bmatrix}
=
\begin{bmatrix} 0&1 \\ 1&1 \end{bmatrix}^2
\begin{bmatrix} F_{k-1} \\ F_k \end{bmatrix}
= \cdots =
\begin{bmatrix} 0&1 \\ 1&1 \end{bmatrix}^{k+1}
\begin{bmatrix} F_{0} \\ F_1 \end{bmatrix}. 
\end{eqnarray}

\item  
因此问题转化成计算矩阵 $A$ 的 $n$ 次幂，其中 
\begin{eqnarray}
A = \begin{bmatrix} 0&1 \\ 1&1 \end{bmatrix}.  
\end{eqnarray}

\end{itemize} 

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{3.2. 计算特征值和特征向量 }

\begin{itemize}\itemsep0.5em 

\item  
计算矩阵 $A$ 的特征值和特征向量，可得 特征值为 
\begin{eqnarray}
\lambda_1 = \frac{1-\sqrt{5}}{2}, \,\,\, \lambda_2 = \frac{1+\sqrt{5}}{2}.
\end{eqnarray}
相应的特征向量为
\begin{eqnarray}
\xi_1 = \begin{bmatrix} \sqrt{5}+1 \\ -2 \end{bmatrix}, \,\,\, 
\xi_2 = \begin{bmatrix} \sqrt{5}-1 \\ 2 \end{bmatrix}. 
\end{eqnarray}


\end{itemize} 

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{3.3. 矩阵相似于对角阵 }

\begin{itemize}\itemsep0.5em 

\item  
设矩阵 
\begin{eqnarray}
P = \begin{bmatrix} \xi_1 & \xi_2 \end{bmatrix}
= \begin{bmatrix} \sqrt{5}+1 & \sqrt{5}-1 \\ -2 & 2 \end{bmatrix}, \,\,\,
B = \begin{bmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \end{bmatrix}
= \begin{bmatrix} \frac{1-\sqrt{5}}{2} & 0 \\ 0 & \frac{1+\sqrt{5}}{2} \end{bmatrix}. 
\end{eqnarray}
则有 
\begin{eqnarray}
P^{-1}AP = B.
\end{eqnarray}

\item  
由此可得 $A = PBP^{-1}$, 以及 
\begin{eqnarray}
A^n = (PBP^{-1})^n = (PBP^{-1})(PBP^{-1})\cdots (PBP^{-1}) = PB^nP^{-1}. 
\end{eqnarray}

\end{itemize} 

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{3.4. 另一种方法求解模型（差分方程降阶方法） }

\begin{itemize}\itemsep0.5em 

\item  设从递推关系式
\begin{eqnarray}
F_{k+2}=F_{k+1}+F_k 
\end{eqnarray}
可以得到 
\begin{eqnarray}
F_{k+2} - a F_{k+1} =b(F_{k+1} - aF_k),   
\end{eqnarray}
其中 $a,b$ 待定。比较两式可得
\begin{eqnarray}
a+b=1,\,\, ab=-1.
\end{eqnarray}
由此求出 $a,b$. 

\item  迭代这个递推关系可得
\begin{eqnarray}
F_{k+2} - a F_{k+1} =b(F_{k+1} - aF_k) = \cdots = b^{k+1}(F_1-aF_0). 
\end{eqnarray}


\end{itemize} 

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{3.5. 差分方程降阶方法 }

\begin{itemize}\itemsep0.5em 

\item  把下述等式相加
\begin{eqnarray}
F_{k+2} - a F_{k+1} &=& b^{k+1}(F_1-aF_0) \\ 
aF_{k+1} - a^2 F_k &=& ab^k(F_1-aF_0) \\ 
a^2F_k - a^3 F_{k-1} &=& a^2b^{k-1}(F_1-aF_0) \\ 
\vdots && \vdots \\ 
a^kF_2 - a^{k+1} F_1 &=& a^kb(F_1-aF_0), 
\end{eqnarray}
可得通项 $F_{k+2}$ 的表达式。


\end{itemize} 

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]{4.1. 编程计算 }

\begin{enumerate}\itemsep0.5em 

\item  载入数值计算模块，使用循环语句直接计算。
\item 
\begin{python}
import numpy as np
N=21
myF=np.zeros(N,dtype=int)

myF[0]=1
myF[1]=1
for k in range(2,N):
    myF[k]=myF[k-1]+myF[k-2]
    
print(myF)
\end{python}

\item  第 $k=0,1,2,\cdots,20$ 个月的兔子数量为
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946 对。
   
   
\end{enumerate} 

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{5.1. 回答问题 }

\begin{enumerate}\itemsep0.5em 

\item  通过矩阵的对角化方法，可以求得数列的通项，也就是第 $k$ 个月的兔子数量为
\begin{eqnarray}
F_k = \left(\frac{1}{2} -\frac{\sqrt{5}}{10} \right)  \left( \frac{1-\sqrt{5}}{2} \right)^k 
+  \left( \frac{1}{2} +\frac{\sqrt{5}}{10} \right)  \left( \frac{1+\sqrt{5}}{2} \right)^k. 
\end{eqnarray}

\end{enumerate}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{6.1. 习题 }

\begin{enumerate}\itemsep0.5em 

\item  求差分方程 $x_{n+2}-x_{n+1}-2x_n=0, x_0=x_1=-2$ 的解。用不同方法求出通项，并编程验证。

\end{enumerate}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{参考文献  }

\begin{thebibliography}{1}

\bibitem{sishoukui-2} 司守奎,孙玺菁. {Python数学建模算法与应用}, 国防工业出版社. 2022年1月第1版. 


\end{thebibliography}


\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

